package com.example.dbsample.util.worker;

import java.security.SecureRandom;

public class RandomWorkerIdAssigner implements WorkerIdAssigner{
    @Override
    public long assignWorkerId() {
        try {
            return SecureRandom.getInstance("SHA1PRNG").nextInt(1000);
        //} catch (NoSuchAlgorithmException e) {
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public long resetWorkId() {
        return assignWorkerId();
    }
}
